import request from '@/utils/request'

export function fetchMerchantBase() {
  return request({
    url: 'backend_get_merchant_type',
    method: 'get'
  })
}
export function fetchMerchantRegion(query) {
  return request({
    url: 'backend_get_region',
    method: 'get',
    params: query
  })
}
export function fetchList(query) {
  return request({
    url: 'backend_get_merchant_list',
    method: 'get',
    params: query
  })
}
export function merchantList(query) {
  return request({
    url: '/merchant/getMerchantList',
    method: 'get',
    params: query
  })
}
export function exceloutmerchant(query) {
  return request({
    url: 'excel_merchant',
    method: 'get',
    params: query
  })
}
export function merchantListOnlyMerchant(query) {
  return request({
    url: 'backend_merchant_and_sale',
    method: 'get',
    params: query
  })
}
export function fetchMerchant(id) {
  return request({
    url: '/merchant/detail',
    method: 'get',
    params: { id }
  })
}

export function deleteMerchant(data) {
  return request({
    url: '/merchant/delete/' + data,
    method: 'delete'
  })
}

export function createMerchant(data) {
  return request({
    url: 'backend_merchant_createupdate',
    method: 'post',
    data
  })
}

export function updateMerchant(data) {
  return request({
    url: 'backend_merchant_createupdate',
    method: 'put',
    data
  })
}

export function updateMerchantStatus(data) {
  return request({
    url: '/merchant/updateStatus',
    method: 'put',
    data
  })
}
export function updateMerchantChecked(data) {
  return request({
    url: '/merchant/updateMerchantChecked',
    method: 'put',
    data
  })
}
export function changeSignDate(data) {
  return request({
    url: 'backend_merchant_change_date',
    method: 'post',
    data
  })
}
export function changeMerchantAuth(data) {
  return request({
    url: 'backend_merchant_auth_esign',
    method: 'post',
    data
  })
}
